<?php
/**
 * Top menu for Wood theme
 *
 * Genmod: Genealogy Viewer
 * Copyright (C) 2002 to 2003 John Finlay and Others
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * @package Genmod
 * @subpackage Themes
 * @version $Id: toplinks.html 10 2013-12-30 20:15:01Z boudewijn.sjouke@gmail.com $
 */

if ($TEXT_DIRECTION=="rtl") $ff="_rtl";
else $ff="";

?>
<br />
    <?php
    //-- gedcom welcome menu
    $menu = get_gedcom_menu();
	$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["gedcom"]["small"];
	$menu["class"] = "menuitem$ff";
	$menu["hoverclass"] = "menuitem_hover$ff";
    $menu["labelpos"] = "right";
    $menu["flyout"] = "down";
	$i=0;
	if (isset($menu["items"]))
	foreach ( $menu["items"] as $key ) {
 	    $menu["items"][$i]["class"] = "submenuitem$ff";
 	    $menu["items"][$i]["hoverclass"] = "submenuitem_hover$ff";
        $menu["items"][$i]["icon"] = "";	// Give the GEDCOM title more room
 		$i++;
	}
    print_menu($menu);
	print "<br />";
    //-- mygedview menu
    $menu = array();
    $menu["label"] = $gm_lang["mygedview"];
    $menu["labelpos"] = "right";
	$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["gedcom"]["small"];
    $menu["link"] = "index.php?command=user";
    $menu["class"] = "menuitem$ff";
    $menu["hoverclass"] = "menuitem_hover$ff";
    $menu["flyout"] = "down";
    $menu["submenuclass"] = "submenu";
    $menu["items"] = get_mygedview_submenu();

	$i=0;
	if (isset($menu["items"]))
	foreach ( $menu["items"] as $key ) {
 	    $menu["items"][$i]["class"] = "submenuitem$ff";
 	    $menu["items"][$i]["hoverclass"] = "submenuitem_hover$ff";
 		$i++;
	}

    print_menu($menu);
    print "<br />";

    //-- charts menu
    $menu = array();
    $menu["label"] 			= $gm_lang["charts"];
    $menu["labelpos"] 		= "right";
	$menu["icon"] 			= $GM_IMAGE_DIR."/".$GM_IMAGES["pedigree"]["small"];
    if (file_exists("pedigree.php")) $menu["link"] 			= "pedigree.php";
    $menu["class"] 			= "menuitem$ff";
    $menu["hoverclass"] 	= "menuitem_hover$ff";
    $menu["flyout"] 		= "down";
    $menu["submenuclass"] 	= "submenu";
    $menu["items"] 			= array();

    if (file_exists("pedigree.php")) {
	    $submenu 				= array();
	    $submenu["label"] 		= $gm_lang["pedigree_chart"];
	    $submenu["labelpos"] 	= "right";
		$submenu["icon"] 		= $GM_IMAGE_DIR."/".$GM_IMAGES["pedigree"]["small"];
	    $submenu["link"] 		= "pedigree.php";
	    $submenu["class"] 		= "submenuitem$ff";
	    $submenu["hoverclass"] 	= "submenuitem_hover$ff";
	    $menu["items"][] 		= $submenu;
    }

    if (file_exists("descendancy.php")) {
	    $submenu 				= array();
	    $submenu["label"] 		= $gm_lang["descend_chart"];
	    $submenu["labelpos"] 	= "right";
		$submenu["icon"] 		= $GM_IMAGE_DIR."/".$GM_IMAGES["descendant"]["small"];
	    $submenu["link"] 		= "descendancy.php";
	    $submenu["class"] 		= "submenuitem$ff";
	    $submenu["hoverclass"] 	= "submenuitem_hover$ff";
	    $menu["items"][] 		= $submenu;
    }

    if (file_exists("timeline.php")) {
	    $submenu = array();
	    $submenu["label"] = $gm_lang["timeline_chart"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["timeline"]["small"];
	    $submenu["link"] = "timeline.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;
    }

    if (file_exists("relationship.php")) {
	    $submenu = array();
	    $submenu["label"] = $gm_lang["relationship_chart"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["relationship"]["small"];
	    $submenu["link"] = "relationship.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;
    }

	if (file_exists("ancestry.php")) {
		$submenu = array();
		$submenu["label"] = $gm_lang["ancestry_chart"];
		$submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["ancestry"]["small"];
		$submenu["link"] = "ancestry.php";
		$submenu["class"] = "submenuitem$ff";
		$submenu["hoverclass"] = "submenuitem_hover$ff";
		$menu["items"][] = $submenu;
	}

	if (file_exists("fanchart.php") and function_exists("imagettftext")) {
		$submenu = array();
		$submenu["label"] = $gm_lang["fan_chart"];
		$submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["fanchart"]["small"];
		$submenu["link"] = "fanchart.php";
		$submenu["class"] = "submenuitem$ff";
		$submenu["hoverclass"] = "submenuitem_hover$ff";
		$menu["items"][] = $submenu;
	}

	if (file_exists("hourglass.php")) {
		$submenu = array();
		$submenu["label"] = $gm_lang["hourglass_chart"];
		$submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["hourglass"]["small"];
		$submenu["link"] = "hourglass.php";
		$submenu["class"] = "submenuitem$ff";
		$submenu["hoverclass"] = "submenuitem_hover$ff";
		$menu["items"][] = $submenu;
	}
	if (file_exists("familybook.php")) {
		$submenu = array();
		$submenu["label"] = $gm_lang["familybook_chart"];
		$submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["fambook"]["small"];
		$submenu["link"] = "familybook.php";
		$submenu["class"] = "submenuitem$ff";
		$submenu["hoverclass"] = "submenuitem_hover$ff";
		$menu["items"][] = $submenu;
	}

    print_menu($menu);
    print "<br />";

    //-- lists menu
    $menu = array();
    $menu["label"] = $gm_lang["lists"];
    $menu["labelpos"] = "right";
	$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["indis"]["small"];
    if (file_exists("indilist.php")) $menu["link"] = "indilist.php";
    $menu["class"] = "menuitem$ff";
    $menu["hoverclass"] = "menuitem_hover$ff";
    $menu["flyout"] = "down";
    $menu["submenuclass"] = "submenu";
    $menu["items"] = array();

    if (file_exists("indilist.php")) {
	    $submenu = array();
	    $submenu["label"] = $gm_lang["individual_list"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["indis"]["small"];
	    $submenu["link"] = "indilist.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;
    }

    if (file_exists("famlist.php")) {
	    $submenu = array();
	    $submenu["label"] = $gm_lang["family_list"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["cfamily"]["small"];
	    $submenu["link"] = "famlist.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;
    }

    //-- produce a plot of statistics
    if (file_exists("statistics.php")&&file_exists("jpgraph")) {
	    $submenu = array();
	    $submenu["label"] = $gm_lang["statistics"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["statistic"]["small"];;
	    $submenu["link"] = "statistics.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover";
	    $menu["items"][] = $submenu;
    }

    //-- list most ancient parent of a family
    if (file_exists("patriarchlist.php")) {
	    $submenu = array();
	    $submenu["label"] = $gm_lang["patriarch_list"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["patriarch"]["small"];;
	    $submenu["link"] = "patriarchlist.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover";
	    $menu["items"][] = $submenu;
    }

    if ($SHOW_SOURCES>=getUserAccessLevel(getUserName())) {
	    if (file_exists("sourcelist.php")) {
		    $submenu = array();
		    $submenu["label"] = $gm_lang["source_list"];
		    $submenu["labelpos"] = "right";
			$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["source"]["small"];
		    $submenu["link"] = "sourcelist.php";
		    $submenu["class"] = "submenuitem$ff";
		    $submenu["hoverclass"] = "submenuitem_hover$ff";
		    $menu["items"][] = $submenu;
	    }

	    if (file_exists("repolist.php")) {
		    $submenu = array();
			$submenu["label"] = $gm_lang["repo_list"];
		    $submenu["labelpos"] = "right";
			$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["source"]["small"];
			$submenu["link"] = "repolist.php";
		    $submenu["class"] = "submenuitem$ff";
			$submenu["hoverclass"] = "submenuitem_hover$ff";
		    $menu["items"][] = $submenu;
	    }
	}

	if (file_exists("placelist.php")) {
	    $submenu = array();
	    $submenu["label"] = $gm_lang["place_list"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["place"]["small"];
	    $submenu["link"] = "placelist.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;
    }

	if (file_exists("aliveinyear.php")) {
		$submenu = array();
		$submenu["label"] = $gm_lang["alive_in_year"];
		$submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["indis"]["small"];
		$submenu["link"] = "aliveinyear.php";
		$submenu["class"] = "submenuitem$ff";
		$submenu["hoverclass"] = "submenuitem_hover$ff";
		$menu["items"][] = $submenu;
	}

	if (file_exists("medialist.php")) {
	    global $MULTI_MEDIA;
	    if( $MULTI_MEDIA ) {
		    $submenu = array();
		    $submenu["label"] = $gm_lang["media_list"];
		    $submenu["labelpos"] = "right";
			$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["media"]["small"];
		    $submenu["link"] = "medialist.php";
		    $submenu["class"] = "submenuitem$ff";
		    $submenu["hoverclass"] = "submenuitem_hover$ff";
		    $menu["items"][] = $submenu;
	    }
    }

    print_menu($menu);
    print "<br />";

    if (file_exists("calendar.php")) {
	    $menu = array();
	    $menu["label"] = $gm_lang["anniversary_calendar"];
	    $menu["labelpos"] = "right";
		$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["calendar"]["small"];
	    $menu["link"] = "calendar.php";
	    $menu["class"] = "menuitem$ff";
	    $menu["hoverclass"] = "menuitem_hover$ff";
	    $menu["submenuclass"] = "submenu";
	    $menu["flyout"] = "down";
	    $menu["items"] = array();

	    $submenu = array();
	    $submenu["label"] = $gm_lang["viewday"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["calendar"]["small"];
	    $submenu["link"] = "calendar.php";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;

	    $submenu = array();
	    $submenu["label"] = $gm_lang["viewmonth"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["calendar"]["small"];
	    $submenu["link"] = "calendar.php?action=calendar";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;

	    $submenu = array();
	    $submenu["label"] = $gm_lang["viewyear"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["calendar"]["small"];
	    $submenu["link"] = "calendar.php?action=year";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;

	    print_menu($menu);
    	print "<br />";
	}

    if (file_exists("reportengine.php")) {
        $menu = array();
        $menu["label"] = $gm_lang["reports"];
        $menu["labelpos"] = "right";
		$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["reports"]["small"];;
        $menu["link"] = "reportengine.php";
        $menu["class"] = "menuitem$ff";
        $menu["hoverclass"] = "menuitem_hover$ff";
        $menu["submenuclass"] = "submenu";
        $menu["flyout"] = "down";
        $menu["items"] = get_reports_submenu("submenuitem$ff", "submenuitem_hover$ff");

        print_menu($menu);
        print "<br />";
        }

    if (file_exists("clippings.php")) {
	    global $ENABLE_CLIPPINGS_CART;
	    if ($ENABLE_CLIPPINGS_CART>=getUserAccessLevel()) {
			$menu = array();
			$menu["label"] = $gm_lang["clippings_cart"];
			$menu["labelpos"] = "right";
			$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["clippings"]["small"];
			$menu["link"] = "clippings.php";
			$menu["class"] = "menuitem$ff";
			$menu["hoverclass"] = "menuitem_hover$ff";
		}
    	print_menu($menu);
    	print "<br />";
    }

    if (file_exists("search.php")) {
	    $menu = array();
	    $menu["label"] = $gm_lang["search"];
	    $menu["labelpos"] = "right";
		$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["search"]["small"];
	    $menu["link"] = "search.php";
	    $menu["class"] = "menuitem$ff";
	    $menu["hoverclass"] = "menuitem_hover$ff";
	    $menu["submenuclass"] = "submenu";
	    $menu["flyout"] = "down";
	    $menu["items"] = array();

	    $submenu = array();
	    $submenu["label"] = $gm_lang["search_general"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["search"]["small"];
	    $submenu["link"] = "search.php?action=general&amp;topsearch=yes";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;

	    $submenu = array();
	    $submenu["label"] = $gm_lang["search_soundex"];
	    $submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["search"]["small"];
	    $submenu["link"] = "search.php?action=soundex&amp;topsearch=yes";
	    $submenu["class"] = "submenuitem$ff";
	    $submenu["hoverclass"] = "submenuitem_hover$ff";
	    $menu["items"][] = $submenu;

    	print_menu($menu);
    	print "<br />";
	}
    global $SHOW_CONTEXT_HELP, $SCRIPT_NAME, $QUERY_STRING, $helpindex;
    //-- help menu
    $menu = array();
    $menu["label"] = $gm_lang["help_page"];
    $menu["labelpos"] = "right";
	$menu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["help"]["small"];
    $menu["link"] = "#";
    if (empty($helpindex)) $menu["onclick"] = "return helpPopup('help_".basename($SCRIPT_NAME)."&amp;action=".$action."');";
    else $menu["onclick"] = "return helpPopup('".$helpindex."');";
    $menu["class"] = "menuitem$ff";
    $menu["hoverclass"] = "menuitem_hover$ff";
    $menu["flyout"] = "down";
    $menu["submenuclass"] = "submenu";
    $menu["items"] = array();

    $submenu = array();
    $submenu["label"] = $gm_lang["help_for_this_page"];
    $submenu["labelpos"] = "right";
	$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["help"]["small"];
    $submenu["link"] = "#";
    if (empty($helpindex)) $submenu["onclick"] = "return helpPopup('help_".basename($SCRIPT_NAME)."&amp;action=".$action."');";
    else $submenu["onclick"] = "return helpPopup('".$helpindex."');";
    $submenu["class"] = "submenuitem$ff";
    $submenu["hoverclass"] = "submenuitem_hover$ff";
    $menu["items"][] = $submenu;

    $submenu = array();
    $submenu["label"] = $gm_lang["help_contents"];
    $submenu["labelpos"] = "right";
	$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["help"]["small"];
    $submenu["link"] = "#";
    $submenu["onclick"] = "return helpPopup('help_contents_help');";
    $submenu["class"] = "submenuitem$ff";
    $submenu["hoverclass"] = "submenuitem_hover$ff";
    $menu["items"][] = $submenu;
    
    if (file_exists("faq.php")) {
		$submenu = array();
		$submenu["label"] = $gm_lang["faq_list"];
		$submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["help"]["small"];
		$submenu["link"] = "faq.php";
		$submenu["class"] = "submenuitem$ff";
		$submenu["hoverclass"] = "submenuitem_hover$ff";
		$menu["items"][] = $submenu;
    }
	
	if (file_exists("searchhelp.php")) {
		$submenu = array();
		$submenu["label"] = $gm_lang["hs_title"];
		$submenu["labelpos"] = "right";
		$submenu["icon"] = $GM_IMAGE_DIR."/".$GM_IMAGES["search"]["small"];
		$submenu["link"] = "#";
    	$submenu["onclick"] = "window.open('searchhelp.php', '', 'top=50,left=10,width=700,height=600,scrollbars=1,resizable=1');";
		$submenu["class"] = "submenuitem$ff";
		$submenu["hoverclass"] = "submenuitem_hover$ff";
		$menu["items"][] = $submenu;
	}

	$menu["items"][]="separator";
    
	//-- add contact links to help menu
    $menuitems = print_contact_links(1);
    foreach($menuitems as $menuitem) {
        $menuitem["class"] = "submenuitem$ff";
    	$menuitem["hoverclass"] = "submenuitem_hover$ff";
        $menu["items"][] = $menuitem;
    }
    $menu["items"][]="separator";

    $submenu = array();
    if ($_SESSION["show_context_help"]) {
    $submenu["label"] = $gm_lang["hide_contexthelp"];
    $submenu["link"] = "$SCRIPT_NAME?$QUERY_STRING&amp;show_context_help=no";
    }
    else {
    $submenu["label"] = $gm_lang["show_contexthelp"];
    $submenu["link"] = "$SCRIPT_NAME?$QUERY_STRING&amp;show_context_help=yes";
    }
    $submenu["labelpos"] = "right";
    $submenu["class"] = "submenuitem$ff";
    $submenu["hoverclass"] = "submenuitem_hover$ff";
    $menu["items"][] = $submenu;

    print_menu($menu);
    print "<br />";
    ?>

<br />
<?php print_user_links(); ?>
<br />
<?php print_contact_links(); ?>
</td>
</tr>
</table>
<?php include("accesskeyHeaders.php"); ?>
</div><!-- close div for div id="header" -->
<?php print "<div id=\"content\">\n"; ?>
